<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite + React + TS</title>
    <!-- APlayer CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" />
    <style>
      /* 音乐播放器侧边栏样式 */
      .music-sidebar {
        position: fixed;
        top: 0;
        right: -320px;
        width: 320px;
        height: 100%;
        background-color: #fff;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        transition: right 0.3s ease;
        padding: 20px;
        box-sizing: border-box;
        overflow-y: auto;
      }
      
      /* 音乐播放器打开时的状态 */
      .music-sidebar.open {
        right: 0;
      }
      
      /* 背景遮罩 */
      .overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
      }
      
      /* 遮罩显示时的状态 */
      .overlay.visible {
        display: block;
      }
      
      /* 音乐按钮样式 */
      .music-toggle-btn {
        position: fixed;
        bottom: 70px;
        right: 20px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-color: #ff6b81;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        cursor: pointer;
        z-index: 998;
        border: none;
        font-size: 20px;
      }
      
      .music-toggle-btn:focus {
        outline: none;
      }
    </style>
  </head>
  <body>
    <div id="root"></div>
    
    <!-- 背景遮罩 -->
    <div class="overlay" id="overlay"></div>
    
    <!-- 音乐播放器侧边栏 -->
    <div class="music-sidebar" id="musicSidebar">
      <h3>音乐播放器</h3>
      <!-- Music Player -->
      <meting-js
        server="netease"
        type="playlist"
        id="3778678"
        autoplay="false"
        list-folded="false">
      </meting-js>
    </div>
    
    <!-- 音乐按钮 -->
    <button class="music-toggle-btn" id="musicToggleBtn">
      🎵
    </button>
    
    <script type="module" src="/src/main.tsx"></script>
    
    <!-- APlayer JS -->
    <script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
    <!-- MetingJS -->
    <script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>
    
    <script>
      // 获取DOM元素
      const musicSidebar = document.getElementById('musicSidebar');
      const overlay = document.getElementById('overlay');
      const musicToggleBtn = document.getElementById('musicToggleBtn');
      
      // 打开音乐侧边栏
      musicToggleBtn.addEventListener('click', () => {
        musicSidebar.classList.add('open');
        overlay.classList.add('visible');
      });
      
      // 点击遮罩关闭侧边栏
      overlay.addEventListener('click', () => {
        musicSidebar.classList.remove('open');
        overlay.classList.remove('visible');
      });
    </script>
  </body>
</html>
